﻿using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Csla;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;

namespace Model
{
    [Serializable()]
    public class DotKhaiBaoBO : Csla.BusinessBase<DotKhaiBaoBO>
    {
        #region Business Properties
        private int? _STT0 = 0;
        public int? STT0
        {
            get { return _STT0; }
            set { _STT0 = value; }
        }

        private string _Ten = null;
        public string Ten
        {
            get { return this._Ten; }
            set { this._Ten = value; }
        }

        protected override object GetIdValue()
        {
            return 0;
        }
        #endregion Business Properties
        //==========================================================================

        #region Factory Methods

        private DotKhaiBaoBO()
        {
        }

        public static DotKhaiBaoBO NewRootDotKhaiBaoBO()
        {
            return DataPortal.Create<DotKhaiBaoBO>(new RootCriteria());
        }

        internal static DotKhaiBaoBO NewChildDotKhaiBaoBO()
        {
            return DataPortal.Create<DotKhaiBaoBO>(new ChildCriteria());
        }
        #endregion Factory Methods
        //==========================================================================

        #region Criteria
        [Serializable()]
        public class RootCriteria
        {
            public RootCriteria() { }
        }

        [Serializable()]
        public class ChildCriteria
        {
            public ChildCriteria() { }
        }
        #endregion Criteria
        //==========================================================================

        #region Create
        [RunLocal]
        private void DataPortal_Create(RootCriteria criteria)
        {
        }

        private void DataPortal_Create(ChildCriteria criteria)
        {
            MarkAsChild();
            ValidationRules.CheckRules();
        }

        #endregion Create
        //==========================================================================

        #region Fetch
        [Transactional(TransactionalTypes.TransactionScope)]
        protected void DataPortal_Fetch(RootCriteria criteria)
        {
            this.Execute_Fetch(criteria);
        }

        protected void DataPortal_Fetch(string where)
        {
            this.Execute_Fetch(where);
        }

        protected void Execute_Fetch(RootCriteria criteria)
        {
        }

        protected void Execute_Fetch(string where)
        {
        }
        #endregion Fetch
        //==========================================================================

        #region Insert
        [Transactional(TransactionalTypes.TransactionScope)]
        protected override void DataPortal_Insert()
        {
            this.Execute_Insert();
        }

        protected void Execute_Insert()
        {
        }
        #endregion Insert
        //==========================================================================

        #region Update
        [Transactional(TransactionalTypes.TransactionScope)]
        protected override void DataPortal_Update()
        {
            this.Execute_Update();
        }

        protected void Execute_Update()
        {
        }
        #endregion Update
        //==========================================================================

        #region Delete
        [Transactional(TransactionalTypes.TransactionScope)]
        protected void DataPortal_DeleteSelf()
        {
            DataPortal_Delete(new RootCriteria());
        }

        private void DataPortal_Delete(RootCriteria criteria)
        {
            this.Execute_Delete(criteria);
        }

        protected void Execute_Delete(RootCriteria criteria)
        {
        }
        #endregion Delete
        //==========================================================================

        #region Internal method
        internal void Insert()
        {
        }

        internal void Update()
        {
        }

        internal void DeleteSelf()
        {
        }
        #endregion Internal method
        //==========================================================================
    }
}
